home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / starcrus.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  9KB  |  265 lines

  1. /***************************************************************************
  2.  
  3. Ramtek Star Cruiser Driver
  4.  
  5. (no known issues)
  6.  
  7. Frank Palazzolo
  8. palazzol@home.com
  9.  
  10. ***************************************************************************/
  11.  
  12. #include "driver.h"
  13. #include "vidhrdw/generic.h"
  14. #include "cpu/i8085/i8085.h"
  15.  
  16. /* included from vidhrdw/starcrus.c */
  17. WRITE_HANDLER( starcrus_s1_x_w );
  18. WRITE_HANDLER( starcrus_s1_y_w );
  19. WRITE_HANDLER( starcrus_s2_x_w );
  20. WRITE_HANDLER( starcrus_s2_y_w );
  21. WRITE_HANDLER( starcrus_p1_x_w );
  22. WRITE_HANDLER( starcrus_p1_y_w );
  23. WRITE_HANDLER( starcrus_p2_x_w );
  24. WRITE_HANDLER( starcrus_p2_y_w );
  25. WRITE_HANDLER( starcrus_ship_parm_1_w );
  26. WRITE_HANDLER( starcrus_ship_parm_2_w );
  27. WRITE_HANDLER( starcrus_proj_parm_1_w );
  28. WRITE_HANDLER( starcrus_proj_parm_2_w );
  29. READ_HANDLER( starcrus_coll_det_r );
  30. extern int starcrus_vh_start(void);
  31. extern void starcrus_vh_stop(void);
  32. extern void starcrus_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  33. extern int p1_sprite;
  34. extern int p2_sprite;
  35. extern int s1_sprite;
  36. extern int s2_sprite;
  37.  
  38. static struct MemoryReadAddress readmem[] =
  39. {
  40.     { 0x0000, 0x0fff, MRA_ROM }, /* Program ROM */
  41.     { 0x1000, 0x10ff, MRA_RAM }, /* RAM */
  42.     { -1 }    /* end of table */
  43. };
  44.  
  45. static struct MemoryWriteAddress writemem[] =
  46. {
  47.     { 0x0000, 0x0fff, MWA_ROM }, /* Program ROM */
  48.     { 0x1000, 0x10ff, MWA_RAM }, /* RAM */
  49.     { -1 }    /* end of table */
  50. };
  51.  
  52. static struct IOReadPort readport[] =
  53. {
  54.     { 0x00, 0x00, input_port_0_r },
  55.     { 0x01, 0x01, input_port_1_r },
  56.     { 0x02, 0x02, starcrus_coll_det_r },
  57.     { 0x03, 0x03, input_port_2_r },
  58.     { -1 }  /* end of table */
  59. };
  60.  
  61. static struct IOWritePort writeport[] =
  62. {
  63.     { 0x00, 0x00, starcrus_s1_x_w },
  64.     { 0x01, 0x01, starcrus_s1_y_w },
  65.     { 0x02, 0x02, starcrus_s2_x_w },
  66.     { 0x03, 0x03, starcrus_s2_y_w },
  67.     { 0x04, 0x04, starcrus_p1_x_w },
  68.     { 0x05, 0x05, starcrus_p1_y_w },
  69.     { 0x06, 0x06, starcrus_p2_x_w },
  70.     { 0x07, 0x07, starcrus_p2_y_w },
  71.     { 0x08, 0x08, starcrus_ship_parm_1_w },
  72.     { 0x09, 0x09, starcrus_ship_parm_2_w },
  73.     { 0x0a, 0x0a, starcrus_proj_parm_1_w },
  74.     { 0x0b, 0x0b, starcrus_proj_parm_2_w },
  75.     { -1 }  /* end of table */
  76. };
  77.  
  78.  
  79.  
  80. INPUT_PORTS_START( starcrus )
  81.         PORT_START    /* player 1 */
  82.         PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY ) /* ccw */
  83.         PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* engine */
  84.         PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY ) /* cw */
  85.         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  86.         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* torpedo */
  87.         PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  88.         PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* phaser */
  89.         PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  90.  
  91.         PORT_START  /* player 2 */
  92.         PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 ) /* ccw */
  93.         PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 ) /* engine */
  94.         PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 ) /* cw */
  95.         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  96.         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 ) /* torpedo */
  97.         PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  98.         PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 ) /* phaser */
  99.         PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  100.  
  101.         PORT_START
  102.         PORT_DIPNAME ( 0x03, 0x02, "Game Time" )
  103.         PORT_DIPSETTING ( 0x03, "60 secs" )
  104.         PORT_DIPSETTING ( 0x02, "90 secs" )
  105.         PORT_DIPSETTING ( 0x01, "120 secs" )
  106.         PORT_DIPSETTING ( 0x00, "150 secs" )
  107.         PORT_DIPNAME ( 0x04, 0x00, DEF_STR( Coinage ))
  108.         PORT_DIPSETTING ( 0x04, DEF_STR( 2C_1C ))
  109.         PORT_DIPSETTING ( 0x00, DEF_STR( 1C_1C ))
  110.         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_COIN2 )
  111.         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_COIN1 )
  112.         PORT_DIPNAME ( 0x20, 0x20, "Mode" )
  113.         PORT_DIPSETTING ( 0x20, "Standard" )
  114.         PORT_DIPSETTING ( 0x00, "Alternate" )
  115.         PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  116.         PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  117. INPUT_PORTS_END
  118.  
  119.  
  120.  
  121. static struct GfxLayout spritelayout1 =
  122. {
  123.     16,16,    /* 16x16 sprites */
  124.     4,          /* 4 sprites */
  125.     1,      /* 1 bits per pixel */
  126.     { 0 },  /* 1 chip */
  127.     { 0*8+4,  0*8+4,  1*8+4,  1*8+4, 2*8+4, 2*8+4, 3*8+4, 3*8+4,
  128.       4*8+4,  4*8+4,  5*8+4,  5*8+4, 6*8+4, 6*8+4, 7*8+4, 7*8+4 },
  129.     { 0, 0, 1*64, 1*64, 2*64, 2*64, 3*64, 3*64,
  130.       4*64, 4*64, 5*64, 5*64, 6*64, 6*64, 7*64, 7*64 },
  131.     1  /* every sprite takes 1 consecutive bit */
  132. };
  133. static struct GfxLayout spritelayout2 =
  134. {
  135.     16,16,   /* 16x16 sprites */
  136.     4,       /* 4 sprites */
  137.     1,       /* 1 bits per pixel */
  138.     { 0 },   /* 1 chip */
  139.     { 0*8+4,  1*8+4,  2*8+4,  3*8+4, 4*8+4, 5*8+4, 6*8+4, 7*8+4,
  140.       8*8+4,  9*8+4,  10*8+4,  11*8+4, 12*8+4, 13*8+4, 14*8+4, 15*8+4 },
  141.     { 0, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
  142.       8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
  143.     1 /* every sprite takes 1 consecutive bytes */
  144. };
  145.  
  146. static struct GfxDecodeInfo gfxdecodeinfo[] =
  147. {
  148.     { REGION_GFX1, 0x0000, &spritelayout1, 0, 1 },
  149.     { REGION_GFX1, 0x0040, &spritelayout1, 0, 1 },
  150.     { REGION_GFX1, 0x0080, &spritelayout1, 0, 1 },
  151.     { REGION_GFX1, 0x00c0, &spritelayout1, 0, 1 },
  152.     { REGION_GFX2, 0x0000, &spritelayout1, 0, 1 },
  153.     { REGION_GFX2, 0x0040, &spritelayout1, 0, 1 },
  154.     { REGION_GFX2, 0x0080, &spritelayout1, 0, 1 },
  155.     { REGION_GFX2, 0x00c0, &spritelayout1, 0, 1 },
  156.     { REGION_GFX3, 0x0000, &spritelayout2, 0, 1 },
  157.     { REGION_GFX3, 0x0100, &spritelayout2, 0, 1 },
  158.     { REGION_GFX3, 0x0200, &spritelayout2, 0, 1 },
  159.     { REGION_GFX3, 0x0300, &spritelayout2, 0, 1 },
  160.     { -1 } /* end of array */
  161. };
  162.  
  163.  
  164. static unsigned char palette[] =
  165. {
  166.     0x00,0x00,0x00, /* Black */
  167.     0xff,0xff,0xff, /* White */
  168. };
  169. static unsigned short colortable[] =
  170. {
  171.     0x00, 0x01, /* White on Black */
  172. };
  173. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  174. {
  175.     memcpy(game_palette,palette,sizeof(palette));
  176.     memcpy(game_colortable,colortable,sizeof(colortable));
  177. }
  178.  
  179. static const char *starcrus_sample_names[] =
  180. {
  181.     "*starcrus",
  182.     "engine.wav",    /* engine sound, channel 0 */
  183.     "explos1.wav",    /* explosion sound, first part, channel 1 */
  184.     "explos2.wav",    /* explosion sound, second part, channel 1 */
  185.     "launch.wav",    /* launch sound, channels 2 and 3 */
  186.     0   /* end of array */
  187. };
  188.  
  189. static struct Samplesinterface samples_interface =
  190. {
  191.     4,    /* 4 channels */
  192.     100,    /* volume */
  193.     starcrus_sample_names
  194. };
  195.  
  196.  
  197. static struct MachineDriver machine_driver_starcrus =
  198. {
  199.     /* basic machine hardware */
  200.     {
  201.         {
  202.             CPU_8080,
  203.             9750000/9,  /* 8224 chip is a divide by 9 */
  204.             readmem,writemem,readport,writeport,
  205.             interrupt,1
  206.         }
  207.     },
  208.     57, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  209.     1,    /* single CPU, no need for interleaving */
  210.     0,
  211.  
  212.     /* video hardware */
  213.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 32*8-1 },
  214.     gfxdecodeinfo,
  215.     sizeof(palette) / sizeof(palette[0]) / 3, sizeof(colortable) / sizeof(colortable[0]),
  216.     init_palette,
  217.  
  218.     VIDEO_TYPE_RASTER,
  219.     0,
  220.     starcrus_vh_start,
  221.     starcrus_vh_stop,
  222.     starcrus_vh_screenrefresh,
  223.  
  224.     /* sound hardware */
  225.     0,0,0,0,
  226.     {
  227.         {
  228.             SOUND_SAMPLES,
  229.             &samples_interface
  230.         }
  231.     }
  232.  
  233. };
  234.  
  235. /***************************************************************************
  236.  
  237.   Game ROMs
  238.  
  239. ***************************************************************************/
  240.  
  241. ROM_START( starcrus )
  242.     ROM_REGION( 0x10000, REGION_CPU1 )  /* code */
  243.     ROM_LOAD( "starcrus.j1",   0x0000, 0x0200, 0x0ee60a50 )
  244.     ROM_LOAD( "starcrus.k1",   0x0200, 0x0200, 0xa7bc3bc4 )
  245.     ROM_LOAD( "starcrus.l1",   0x0400, 0x0200, 0x10d233ec )
  246.     ROM_LOAD( "starcrus.m1",   0x0600, 0x0200, 0x2facbfee )
  247.     ROM_LOAD( "starcrus.n1",   0x0800, 0x0200, 0x42083247 )
  248.     ROM_LOAD( "starcrus.p1",   0x0a00, 0x0200, 0x61dfe581 )
  249.     ROM_LOAD( "starcrus.r1",   0x0c00, 0x0200, 0x010cdcfe )
  250.     ROM_LOAD( "starcrus.s1",   0x0e00, 0x0200, 0xda4e276b )
  251.  
  252.     ROM_REGION( 0x0200, REGION_GFX1 | REGIONFLAG_DISPOSE )
  253.     ROM_LOAD( "starcrus.e6",   0x0000, 0x0200, 0x54887a25 )
  254.  
  255.     ROM_REGION( 0x0200, REGION_GFX2 | REGIONFLAG_DISPOSE )
  256.     ROM_LOAD( "starcrus.l2",   0x0000, 0x0200, 0x54887a25 )
  257.  
  258.     ROM_REGION( 0x0400, REGION_GFX3 | REGIONFLAG_DISPOSE )
  259.     ROM_LOAD( "starcrus.j4",   0x0000, 0x0200, 0x25f15ae1 )
  260.     ROM_LOAD( "starcrus.g5",   0x0200, 0x0200, 0x73b27f6e )
  261. ROM_END
  262.  
  263.  
  264. GAME( 1977, starcrus, 0, starcrus, starcrus, 0, ROT0, "Ramtek", "Star Cruiser" )
  265.